<?php
	require_once("../../../include/connect.php");
	require_once("../../../include/datetime.php");
	
	$category = $_POST['select'];
	$topic = $_POST['tieude'];
	$content_sum = $_POST['tomtat'];
	$content = $_POST['noidung'];
	$id = $_POST['id'];
	
	if($category != "" && $topic != "" && $content_sum != "" && $content != "")
	{
		move_uploaded_file($_FILES["file"]["tmp_name"], "../../../img/upload/".$_FILES["file"]["name"]);
		
		$query = mysql_query("  UPDATE news SET topic = N'{$topic}', content_sum = N'{$content_sum}', content = N'{$content}', category_id = '{$category}' 
								WHERE id = {$id} ");
		if($query)
			header("Location:../index.php?p=new&msg=success");	
	}
	else
		header("Location:../index.php?p=new&msg=null");
		//echo $category."-".$topic."-".$content_sum."-".$content;

		
?>
